<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div id="app1">
        <quanju></quanju>
        <jubu></jubu>
    </div>
    <hr>
    <div id="app2">
        <quanju></quanju>
        <jubu></jubu>
    </div>

</body>
<script src="../js/http_cdn.bootcdn.net_ajax_libs_vue_2.6.6_vue.js"></script>
<script>
    const quanju = Vue.extend({
        template: `
                    <div>
                        <h1>我是全局组件</h1>
                        <div>我是全局组件</div>
                    </div>
                `
    })

    const jubu = Vue.extend({
        template: `
                    <div>
                        <h1>我是局部组件</h1>
                        <div>我是局部组件</div>
                    </div>
                `
    })

    // 全局注册组件
    Vue.component("quanju", quanju)

    new Vue({
        el: "#app1"
    })


    new Vue({
        el: "#app2",
        components: {
            // 组件标签的名字 : 组件的内容
            'jubu': jubu
        }
    })
</script>

</html>
